Class HCC.DT.HCC2HL72.NewOrderUpd Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='POOR_IN200902UV:POOR_IN200902UV' targetDocType='2.5.1:OMP_O09' create='new' language='objectscript' >
<assign value='source.{id(1).extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime(1).value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"OMP"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"O09"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.time.validTimeLow}' property='target.{ORCgrp(1).ORC:OrderEffectiveDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:OrderingProvider(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.signatureText.value}' property='target.{ORCgrp(1).ORC:OrderingProvider(1).GivenName}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup(1).author.assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{ORCgrp(1).ORC:OrderingProvider(1).FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().representedOrganization.id().item().extension}' property='target.{ORCgrp().ORC:OrderingFacilityName(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().representedOrganization.name},"//s:item/s:part/@value")' property='target.{ORCgrp().ORC:OrderingFacilityName().OrganizationName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().verifier().time.value}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).EffectiveDate}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().verifier().assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().verifier().assignedEntity().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{ORCgrp(1).ORC:VerifiedBy(1).GivenName}' action='set' />
<assign value='"LAB"' property='target.{ORCgrp().ORC:OrderType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).id(1).item(2).extension}' property='target.{PIDgrp.PV1grp.PV1:VisitNumber.IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).code.code}' property='target.{PIDgrp.PV1grp.PV1:AdmissionType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().code.displayName.value}' property='target.{PIDgrp.PV1grp.PV1:PatientClass}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().location.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Bed}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().location.asLocatedEntityPartOf().location().name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Room}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.name})' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Facility}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.asOrganizationPartOf().wholeOrganization.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Floor}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().subject().patient().telecom},"//s:item/@value")' property='target.{PIDgrp.PID:PhoneNumberHome(1).TelephoneNumber}' action='set' />
<assign value='"2.5"' property='target.{MSH:VersionID}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).id.item(2).extension}' property='target.{PIDgrp.PID:PatientID}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).extension}' property='target.{PIDgrp.PID:PatientIdentifierList(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).component2(1).choice.observationRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).root}' property='target.{PIDgrp.PID:PatientIdentifierList(1).IdentifierTypeCode}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.administrativeGenderCode.displayName.value}' property='target.{PIDgrp.PID:AdministrativeSex}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.birthTime.value}' property='target.{PIDgrp.PID:DateTimeofBirth}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.name})' property='target.{PIDgrp.PID:PatientName(1)}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().asContent().containerPackagedProduct().capacityQuantity.unit}' property='target.{ORCgrp(1).RXCgrp(1).RXC:ComponentUnits.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().asContent().containerPackagedProduct().capacityQuantity.value}' property='target.{ORCgrp().RXCgrp().RXC:ComponentAmount}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().routeCode.code}' property='target.{ORCgrp(1).RXR(1):Route.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().routeCode.displayName.value}' property='target.{ORCgrp().RXR():Route.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseQuantity.value}' property='target.{ORCgrp().RXO:RequestedGiveAmountMinimum}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseQuantity.unit}' property='target.{ORCgrp().RXO:RequestedGiveUnits.Text}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseCheckQuantity.item().numerator},"/@value")' property='target.{ORCgrp(1).RXO:TotalDailyDose.Quantity}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseCheckQuantity.item().numerator},"/@unit")' property='target.{ORCgrp().RXO:TotalDailyDose.Units.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().administrationUnitCode.displayName.value}' property='target.{ORCgrp().RXR(1):AdministrationSite.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().subjectOf3().policy().code().displayName.value}' property='target.{ORCgrp().RXO:PharmacyOrderType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().code.code}' property='target.{ORCgrp().RXO:RequestedGiveCode.Identifier}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().name},"//s:item/s:part/@value")' property='target.{ORCgrp().RXO:RequestedGiveCode.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().subjectOf6().annotation().text().value}' property='target.{ORCgrp(1).NTE(1):Comment(1)}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().pertinentInformation().choice.choice.observation().value},"//s:displayName/@value")' property='target.{ORCgrp().NTE():CommentType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().component2().choice.supplyRequest().quantity.value}' property='target.{ORCgrp().RXO:RequestedDispenseAmount}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().component2().choice.supplyRequest().quantity.unit}' property='target.{ORCgrp().RXO:RequestedDispenseUnits.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().id.extension}' property='target.{ORCgrp(1).TQ1grp(1).TQ2(1):SetIDTQ2}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().code.displayName.value}' property='target.{ORCgrp().TQ1grp().TQ2():SequenceResultsFlag}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().statusCode.code}' property='target.{ORCgrp().TQ1grp().TQ2():SequenceConditionCode}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().effectiveTime},"//s:code/s:displayName/@value")' property='target.{ORCgrp().TQ1grp().TQ2():CyclicGroupMaximumNumberofRe}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().effectiveTime.validTimeLow}' property='target.{ORCgrp().TQ1grp().TQ1:Startdatetime}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().effectiveTime.validTimeHigh}' property='target.{ORCgrp().TQ1grp().TQ1:Enddatetime}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().location().serviceDeliveryLocation().location.name},"//s:item/s:part/@value")' property='target.{PIDgrp.PV1grp.PV1:ServicingFacility}' action='set' />
</transform>
}

}
